/**Core :CaptchaImageTag Class
 * @ author : Tran Nguyen Anh Tu & Nguyen Thai Duy Khang
 * @ Function : Some random method 
 */
package Utility.CustomTag;

import Ultility.*;
import java.awt.Font;
import java.awt.GraphicsEnvironment;
import java.io.IOException;
import java.util.Random;
import javax.servlet.jsp.JspException;
import javax.servlet.jsp.JspWriter;
import javax.servlet.jsp.tagext.SimpleTagSupport;
import Ultility.CaptchaImage;
import java.io.File;
import Ultility.RandomCollection;

public class CaptchaImageTag extends SimpleTagSupport{
    protected  String url;
    /*
     * Function : Create a random String 
     */
    public void setUrl(String url)
    {
        this.url=url;
        String captchar=RandomCollection.ChacractersRandom();
        String font=RandomCollection.FontRandom();
        String url_absolute="C:/Users/chickencake1/Dropbox/Shared Project/Khang/GreenBookOnline/web/Resources/CaptchaImage_fesh.jpg"; 
        File file=new File(url_absolute);
        CaptchaImage.writeJPEG(CaptchaImage.makeMessageImage(captchar,font,20),file);
    }

    @Override
    public void doTag() throws JspException, IOException {
     
    }
}
